package cn.smxy.vo;

import cn.smxy.pojo.Plant;
import cn.smxy.pojo.PlantPicture;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class PlantVo extends Plant {
    private String categoryName;
    private String familyName;
    private String genusName;
    private String userName;
    private Long userCreateTime;
    private String userPhoto;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long genusId;
    private List<PlantPicture> plantPictures;

    public PlantVo(Plant plant) {
        super(plant.getPlantId(),
                plant.getPlantName(),
                plant.getPlantSpecific(),
                plant.getLatinName(),
                plant.getCategoryId(),
                plant.getFamilyId(),
                plant.getPlantDescription(),
                plant.getAddress(),
                plant.getPlantPicture(),
                plant.getUserId(),
                plant.getCreateTime(),
                plant.getIsChoiceness());
    }
}
